package com.itheima.myException;

import java.util.Scanner;

public class Demo3 {
    public static void main(String[] args) {
        Student stu = new Student();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入您的名字:");
        String name = sc.next();
        stu.setName(name);
        System.out.println("请输入您的年龄");
        String stringAge = sc.next();
        try {
            int age = Integer.parseInt(stringAge);
            stu.setAge(age);
        }catch (AgeOutOfBoundsException e){
            System.out.println(e.toString());
            e.printStackTrace();
        }catch(NumberFormatException e){
            e.printStackTrace();
        }
    }
}
